<?php

namespace App;

use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\SoftDeletes;

class Appointment extends Model
{
    use SoftDeletes;

    /**
     * The attributes that are mass assignable.
     *
     * @var array
     */
    protected $fillable = [
    ];

    /**
     * The attributes excluded from the model's JSON form.
     *
     * @var array
     */
    protected $hidden = [
        //'id',
        //'updated_at',
        //'deleted_at'
    ];

    public function getBookAttribute() {

        return Book::find($this->attributes['book_id']);

    }

    public function getPredecessorAttribute() {

        return User::find($this->attributes['predecessor_id']);

    }

    public function getSuccessorAttribute() {

        return User::find($this->attributes['successor_id']);

    }

    /**
     * The accessors to append to the model's array form.
     *
     * @var array
     */
    protected $appends = ['book', 'predecessor', 'successor'];

}
